package com.czk.lambda;

import com.czk.aop.entity.User;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.GenericApplicationContext;

/**
 * @Author:ChenZhangKun
 * @Date: 2020/11/25 20:13
 */
public class TestGenericApplicationContext {
    @Test
    public void test() {
        // 创建GenericApplicationContext对象
        GenericApplicationContext context = new GenericApplicationContext();
        // 清空容器
        context.refresh();
        // 注册对象
        context.registerBean("user1",User.class, () -> new User());
        // 获取注册的spring对象
        User user = (User) context.getBean("user1");
        System.out.println(user);
    }
}
